package com.marketapp.service;

import org.springframework.security.authentication.encoding.MessageDigestPasswordEncoder;

public class PasswordGeneratorImpl implements IPasswordGenerator {
	
	MessageDigestPasswordEncoder passwordEncoder = new MessageDigestPasswordEncoder("MD5");
	
	public MessageDigestPasswordEncoder getPasswordEncoder() {
		return passwordEncoder;
	}

	public void setPasswordEncoder(MessageDigestPasswordEncoder passwordEncoder) {
		this.passwordEncoder = passwordEncoder;
	}

	@Override
	public String generatePassword(String password) {
		return passwordEncoder.encodePassword(password, null);
	}

}
